package com.line.tools.zto;

import com.alibaba.fastjson.JSONObject;
import com.line.config.cons.CodeCons;
import com.line.config.exception.GlobalResponseException;
import com.line.tools.zto.pojo.traces.ResDataPojo;
import com.zto.zop.ZopClient;
import com.zto.zop.ZopPublicRequest;
import org.springframework.stereotype.Service;

@Service
public class ZtoService {

	public String traces(String billCode) {
		String result = "";
		try {
			ZopClient client = new ZopClient("56917b8e0eb54f73b164e0653074d205", "e3417af1699d");
			ZopPublicRequest request = new ZopPublicRequest();
			request.addParam("company_id", "56917b8e0eb54f73b164e0653074d205");
			request.addParam("msg_type", "NEW_TRACES");
			request.addParam("data", "[" + billCode + "]");
			request.setUrl("http://japi.zto.cn/traceInterfaceNewTraces");
			result = client.execute(request);
		} catch (Exception ex) {
			throw new GlobalResponseException(CodeCons.ZTO_TRACES_EXCEPTION);
		}

		return result;
	}
}
